package com.llkj.qingnianguoxue.util;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.llkj.qingnianguoxue.base.ConstantUserInfo;
import com.llkj.qingnianguoxue.base.MyApplication;
import com.llkj.qingnianguoxue.course.CourseDetailActivity;
import com.llkj.qingnianguoxue.home.ActionDetailActivity;
import com.llkj.qingnianguoxue.home.BookDetailActivity;
import com.llkj.qingnianguoxue.home.MasterDetailActivity;
import com.llkj.qingnianguoxue.home.VideoDetailActivity;
import com.llkj.qingnianguoxue.music.MusicDetailActivity;
import com.llkj.qingnianguoxue.zhuanlan.BookZhiBoActivity;
import com.llkj.qingnianguoxue.zhuanlan.ZhiBoDetailActivity;

/**
 * Created by thinkpad on 2018/9/26.
 */

public class LunBoJumpUtil {
    public static boolean jumpTo(Context context,String type,String id){
        if ("1".equals(type)) {
            Intent intent = new Intent(context, ActionDetailActivity.class);
            intent.putExtra("id",id);
            context.startActivity(intent);
        } else if ("2".equals(type)) {
            boolean isLogin = MyApplication.getInstance().sputil.getBoolean(ConstantUserInfo.ISLOGIN);
            if (!isLogin) {
                return false;
            }
            int state = 0;// state状态1 直播中 2 未开始 3 已结束
//                    try {
//                        state = Integer.parseInt(lunboBean.getState());
//                    } catch (Exception e) {
//                        e.printStackTrace();
//                    }
//                    Bundle bundle = new Bundle();
//                    bundle.putString("id", lunboBean.getContent_id());
//                    switch (state) {
//                        case 2:
//                            startActivity(BookZhiBoActivity.class, bundle);
//                            break;
//                        case 1:
//                            bundle.putString("type", "1");
//                            startActivity(ZhiBoDetailActivity.class, bundle);
//                            break;
//                        case 3:
//                            bundle.putString("type", "2");
//                            startActivity(ZhiBoDetailActivity.class, bundle);
//                            break;
//                    }
        } else if ("3".equals(type)) {
            Intent intent = new Intent(context, VideoDetailActivity.class);
            intent.putExtra("id",id);
            context.startActivity(intent);
        } else if ("4".equals(type)) {
            Intent intent = new Intent(context, BookDetailActivity.class);
            intent.putExtra("id",id);
            context.startActivity(intent);
        }else if("5".equals(type)){
            Intent intent = new Intent(context, MasterDetailActivity.class);
            intent.putExtra("id",id);
            context.startActivity(intent);
        }else if("6".equals(type)){
            Intent intent = new Intent(context, CourseDetailActivity.class);
            intent.putExtra("id",id);
            context.startActivity(intent);
        }else if("7".equals(type)){
            Intent intent = new Intent(context, MusicDetailActivity.class);
            intent.putExtra("musicId",id);
            context.startActivity(intent);
        }
        return true;
    }
}
